package g2.routemaster.gui.dialogs;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IconAndMessageDialog;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;


public class DrawCardDialog extends IconAndMessageDialog {
   // The image
   private Image image;

   /**
    * DumbMessageDialog constructor
    * 
    * @param parent the parent shell
    */
   public DrawCardDialog(Shell parent) {
      super(parent);
     
      // Set the default message
      message = "";
   }
   
   public void setImage(Image image) {
      this.image = image;
   }
   
   /**
    * Sets the message
    * 
    * @param message the message
    */
   public void setMessage(String message) {
      this.message = message;
   }

   /**
    * Closes the dialog
    * 
    * @return boolean
    */
   public boolean close() {
      if (image != null) image.dispose();
      return super.close();
   }

   /**
    * Creates the dialog area
    * 
    * @param parent the parent composite
    * @return Control
    */
   
   protected Control createDialogArea(Composite parent) {
      createMessageArea(parent);
      getShell().setText("Draw Card");
      return parent;
   }

   /**
    * Creates the buttons
    * 
    * @param parent the parent composite
    */
   protected void createButtonsForButtonBar(Composite parent) {
      createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
            true);
   }

   /**
    * Gets the image to use
    */
   protected Image getImage() {
      return image;
   }
}
